<?php

namespace app\common\model;

use think\Model;

/**
 * Class trOutletsCar
 * @property trCar $car
 * @property trCarList $plateNumber
 * @package app\common\model
 * 网点的车表
 */
class trOutletsCar extends Model
{
    protected $pk = 'id';
    protected $resultSetType = 'collection'; //申明结果集是数据集对象（collection），查询结果才能用toArray()方法转为数组
    protected $name = "outlets_car"; //表名

    protected $type = [
        'create_time'  =>  'timestamp:Y-m-d H:i:s',
        'update_time'  =>  'timestamp:Y-m-d H:i:s',
    ];

    public function car(){
        return $this->hasOne(trCar::class, "id", "car_id");
    }

    public function plateNumber(){
        return $this->hasMany(trCarList::class, "attr_id", "id")
            ->where("type", "=", 5);
    }
}